import 'dart:async';

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class CCBNewsDetailPage extends StatefulWidget {

  String title;
  String url;
  CCBNewsDetailPage({Key key, this.title, this.url}) : super( key: key);

  @override
  _CCBNewsDetailPageState createState() => new _CCBNewsDetailPageState();
}

class _CCBNewsDetailPageState extends State<CCBNewsDetailPage>{

  @override
  Widget build(BuildContext context) {

    final Completer<WebViewController> _controller = Completer<
        WebViewController>();

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: WebView(
        initialUrl: widget.url,
        javascriptMode: JavascriptMode.unrestricted,
        onWebViewCreated: (WebViewController webViewController) {
          _controller.complete(webViewController);
        },
        onProgress: (int progress) {
          print("WebView is loading (progress : $progress%)");
        },
        onPageStarted: (String url) {
          print('Page started loading: $url');
        },
        onPageFinished: (String url) {
          print('Page finished loading: $url');
        },
        gestureNavigationEnabled: true,
      ),
    );
  }

}